package com.vxdata.utils.modules.utils.zstp;

import cn.hutool.cache.Cache;
import cn.hutool.cache.CacheUtil;

public class HutoolCacheUtil {

    public static Cache<String, String> cache = CacheUtil.newTimedCache(5 * 60 * 1000);

    public static void put(String key, String value) {
        try {
            cache.put(key, value);
        } catch (Exception e) {
            // 处理异常，比如日志记录等
            e.printStackTrace();
        }
    }

    public static void remove(String key) {
        try {
            cache.remove(key);
        } catch (Exception e) {
            // 处理异常，比如日志记录等
            e.printStackTrace();
        }
    }

    public static String get(String key) {
        try {
            return cache.get(key);
        } catch (Exception e) {
            // 处理异常，比如日志记录等
            e.printStackTrace();
            return null;
        }
    }

    public static void main(String[] args) {
        HutoolCacheUtil.put("a", "1");
        System.out.println(HutoolCacheUtil.get("a"));
    }


}
